-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc: --emit=rlibmeta outputs an rlib with only metadata, works with -Z no-trans. #26234
Conversation
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
Nice! This feels like it's a bit ad-hoc though and it'd unfortunately be an insta-stable interface to the compiler. For something like Some specific concerns I have are:
|
r? @alexcrichton I've got no opinion on the design issues. |
... So GitHub/chromium managed to lose my comment, and I'm not retyping all that. The reason Should this kind of metadata always be emitted before trans, with certain information missing? That would make sense if it was going to be used to pipeline compilations. |
With rust-lang/cargo#1701, I believe that
Interesting! I had forgotten about this. This poses an interesting problem that may be difficult to overcome, unfortunately. In terms of pipelining compilations, there are two synchronization points which need to happen if we have two sets of metadata:
I feel like managing multiple synchronization points in the compiler could get quite complicated (even one is nontrivial), and if we take a route like this I'd much prefer to minimize the complexity as much as possible. In the ideal world we could do something like have a "dry run" of trans which doesn't actually translate anything (but calculates symbol names), or perhaps even just have the ability to calculate symbol names ahead of trans. That way there'd only need to be one metadata format that's the same across dylibs, rlibs, and standalone files. |
Ah, that's a good point, I had forgotten how deterministic everything should be - maybe it can be computed ahead of trans (and... cached, so trans is more efficient at it. may also be possible to run trans from the metadata alone). |
I would also be somewhat more comfortable landing this ahead of time if the ability to emit a metadata file is tied to the ability to use unstable features (e.g. this is only enabled on nightly). |
Ideally I'd also like |
@@ -785,7 +787,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> { | |||
"NAME"), | |||
opt::multi("", "emit", "Comma separated list of types of output for \ | |||
the compiler to emit", | |||
"[asm|llvm-bc|llvm-ir|obj|link|dep-info]"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manpage must be updated too.
Bikeshed: Is rlibmeta somehow specific to rlibs? Don’t we bundle metadata with shared libraries as well? If so, could this be named just |
Yeah I definitely think we'll want a separate and dedicated file for this, but I don't think we should be producing one in all cases. It's quite nice that an rlib and/or dylib is a standalone artifact that doesn't need to be paired with something else, so I'd prefer to keep it like that if possible.
Good point! I'd also be fine with |
@nagisa shared libraries use compressed metadata - there was also "rlib" in there because, well, it's a "valid" rlib right now (if you don't try linking with it). |
☔ The latest upstream changes (presumably #26351) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing out of inactivity now, but I'm excited to see where this goes in the future! |
I just realized that crater might have an use for this. Could be a good reason to revive the branch. |
Useful for running analysis passes on downstream crates without actually doing codegen.
cc @bstrie who wants to use this for a
cargo check
command.